#ifndef Q_BASIC_DEFS_HH
#define Q_BASIC_DEFS_HH

#include <QFile>
#include <QTextStream>

#ifndef CLS_NAME
#define CLS_NAME QString(__FUNCTION__).left(QString(__FUNCTION__).indexOf("::")).toLower()
#endif // CLS_NAME

#ifndef CLS_STYLE_FILE_NAME
#define CLS_STYLE_FILE_NAME QString(":/webPlayer/%1.qss").arg(CLS_NAME)
#endif // CLS_STYLE_FILE_NAME

#ifndef Q_WINDOW_LOAD_STYLE
#define Q_WINDOW_LOAD_STYLE do { \
	QFile file(CLS_STYLE_FILE_NAME); \
	file.open(QFile::ReadOnly); \
	QTextStream filetext(&file); \
	QString stylesheet = filetext.readAll(); \
	this->setStyleSheet(stylesheet); \
	file.close(); \
} while (false)
#endif // Q_WINDOW_LOAD_STYLE

#ifndef Q_WINDOW_LOAD_STYLE_EX
#define Q_WINDOW_LOAD_STYLE_EX(ex) do { \
	QFile file(CLS_STYLE_FILE_NAME); \
	file.open(QFile::ReadOnly); \
	QTextStream filetext(&file); \
	QString stylesheet = filetext.readAll(); \
	stylesheet.ex; \
	this->setStyleSheet(stylesheet); \
	file.close(); \
} while (false)
#endif // Q_WINDOW_LOAD_STYLE


#endif // Q_BASIC_DEFS_HH
